#include <iostream>
#include <ctime>
#include <sys/types.h>
#include<unistd.h>
#include "ThreadPool.hpp"
#include"Task.hpp"


int main()
{
    std::cout<<"process is running..."<<std::endl;
    sleep(3);
    //获取单例对象
    ThreadPool<Task>::GetInstance()->Start();
    srand(time(nullptr) ^ getpid());
    //构建任务
    while(true)
    {
        int x=rand()%10+1;
        char op=opers[rand()%opers.size()];
        int y=rand()%10;
        Task t(x,y,op);
        ThreadPool<Task>::GetInstance()->Push(t);
        std::cout << "main thread make task: " << t.GetTask() << std::endl;
        sleep(1);
    }
    return 0;
}